package middleware

import (
	"github.com/atreugo/cors"
	"github.com/savsgio/atreugo/v11"
)

func Cors() atreugo.Middleware {
	return cors.New(cors.Config{
		AllowedOrigins:   []string{"*"},
		AllowedHeaders:   []string{"Content-Type", "X-Custom", "Token", "Authorization", "token"},
		AllowedMethods:   []string{"GET", "POST", "PUT", "DELETE"},
		ExposedHeaders:   []string{"Content-Length", "Authorization", "Token", "Authorization", "token"},
		AllowCredentials: true,
		AllowMaxAge:      3600,
	})
}
